package org.example.news_check.Pojo;

public class AjaxResult {
    private boolean success;
    private String msg;
    private Object data;

    public static AjaxResult success() {
        AjaxResult result = new AjaxResult();
        result.setSuccess(true);  // 现在可以正常调用
        return result;
    }

    public static AjaxResult success(Object data) {
        AjaxResult result = new AjaxResult();
        result.setSuccess(true);
        result.setData(data);
        return result;
    }

    public static AjaxResult error(String msg) {
        AjaxResult result = new AjaxResult();
        result.setSuccess(false);
        result.setMsg(msg);
        return result;
    }

    // Getter and Setter
    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {  // 新增的Setter方法
        this.success = success;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
